import request from '@/utils/request'


const api_name = `/carType`

export default{
    //获取车辆类型树
    getTree(pid){
        return request({
            url:`${api_name}/tree/${pid}`,
            method:'get'
        })
    },
    //根据pid获取子类型
    getChildren(pid){
        return request({
            url:`${api_name}/getChildren/${pid}`,
            method:'get'
        })
    },
    //新增/修改汽车类型
    addOrUpdateCarType(carType){
        return request({
            url:`${api_name}`,
            method:'put',
            data:carType
        })
    },
    //删除自己和下面的所有子节点
    delete(id){
        return request({
            url:`${api_name}/${id}`,
            method:'delete'
        })
    },
    //批量删除
    batchDelete(ids){
        return request({
            url:`${api_name}/batchDelete`,
            method:'post',
            data:ids
        })
    }
}